package cn.kimming.wms.web.interceptor;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import cn.kimming.wms.domain.Employee;
import cn.kimming.wms.util.UserContext;

/**
 * 登录检查拦截器
 * @author Kimming
 */
public class LoginInterceptor extends AbstractInterceptor{

	private static final long serialVersionUID = -6162796294420336649L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Employee user = UserContext.getUser();
		if (user == null) {
			return Action.LOGIN;
		}
		return invocation.invoke();
	}

}
